package server.business.shop.config;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.poi.ss.usermodel.Workbook;

import server.ServerConfigCache;
import server.messageId.C2SMessageId.Shop;
import server.utils.AppFile;

import com.core.config.GameModel;
import com.core.config.ILoader;
import com.core.utils.ExcelUtils;

/**
 * 商城配置加载
 * @author King
 *
 */
public class ShopConfigLoader implements ILoader {

	private static final String excelName = "shop.xls";
	
	
	@Override
	public void load()
	{
		Workbook wb = ExcelUtils.loadExcel(AppFile.getExcelConfig(excelName));
		List<ShopConfig> itemList = new ArrayList<ShopConfig>();
		GameModel.initModels(wb.getSheetAt(0), ShopConfig.class, itemList);
		ServerConfigCache.shopMap = new ConcurrentHashMap<Integer, ShopConfig>();
		GameModel.listToMap(itemList, ServerConfigCache.shopMap, "itemId");
	}

}
